package com.example.myapplication;


import android.content.Intent;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
 private   EditText user;
  private EditText password;
   private Button log_cs;
   private TextView springs;


    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.log);
        log_cs=(Button) findViewById(R.id.log);
        user=(EditText) findViewById(R.id.user);
        password=(EditText) findViewById(R.id.password);
        springs=findViewById(R.id.spring);




        log_cs.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
            shows();



            }
        });

    } public void shows(){

        String u="liujiang";
        String p="123";
        String name=user.getText().toString();
        String passwords=password.getText().toString();

        if (name.equals(u)||passwords==p){
            Intent intent1=new Intent(MainActivity.this,show.class);
            startActivity(intent1);
        }else {
            springs.setText("登陆失败");
           Toast.makeText(this,"登陆失败",Toast.LENGTH_SHORT).show();
        }
    }
}

